
// <copyright file="DynamicStringReplaceHelperTests.cs" company="Subhadra Software Solutions">
//   
// </copyright>
// <summary>
//   Class DynamicStringReplaceHelperTests.
// </summary>

namespace SubhadraSolutions.Sharp.Utils.Tests.Reflection
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using SubhadraSolutions.Sharp.Utils.Reflection;
    using SubhadraSolutions.Sharp.Utils.Tests.DummyClasses;

    /// <summary>
    ///     Class DynamicStringReplaceHelperTests.
    /// </summary>
    [TestClass]
    public class DynamicStringReplaceHelperTests
    {
        #region Public Methods and Operators

        /// <summary>
        ///     Tests this instance.
        /// </summary>
        [TestMethod]
        public void Test()
        {
            Department1 d = Department1.BuildDummyDepartment1();
            foreach (Employee1 emp in d.Employees)
            {
                emp.FirstName = "ABC" + emp.FirstName + "XyZ";
                emp.LastName = "abc" + emp.LastName + "xYz";
            }

            DynamicStringReplaceHelper<Employee1>.ReplaceStrings(d.Employees, "abc", null, true);
            DynamicStringReplaceHelper<Employee1>.ReplaceStrings(d.Employees, "xyz", null, true);

            foreach (Employee1 emp in d.Employees)
            {
                string s = emp.FirstName.ToUpper();
                Assert.IsFalse(s.Contains("ABC"));
                Assert.IsFalse(s.Contains("XYZ"));

                s = emp.LastName.ToUpper();
                Assert.IsFalse(s.Contains("ABC"));
                Assert.IsFalse(s.Contains("XYZ"));
            }
        }

        #endregion Public Methods and Operators
    }
}
